package com.gzx.spring.db.service.impl;

import java.util.List;

import org.springframework.stereotype.Service;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gzx.spring.db.entity.Simple;
import com.gzx.spring.db.mapper.SimpleMapper;
import com.gzx.spring.db.param.AddParam;
import com.gzx.spring.db.param.IdParam;
import com.gzx.spring.db.service.SimpleService;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollStreamUtil;
@Service
@DS("risk")
public class SimpleServiceImpl extends ServiceImpl<SimpleMapper, Simple> implements SimpleService {

	@Override
	public void add(AddParam param) {
		Simple simple = BeanUtil.toBean(param, Simple.class);
        this.save(simple);
	}

	@Override
	public void delete(List<IdParam> paramList) {
		 // 执行删除
        this.removeByIds(CollStreamUtil.toList(paramList, IdParam::getId));
	}
}
